DXL script to search for a specific string in table object

I'm very much new to Doors DXL scripting.

Problem:
If the object contains table, object."Object Text" doesn't give the table data.
How to loop through the table cells and search for a specific string, if present to export the entire table into excel(exporting to excel i can do for just text object by using object."Object Text".

Any links where i can learn how to handle tables like (Searching, Copying etc).
GaneshPrasadE - Mon Mar 26 04:57:59 EDT 2012

Re: DXL script to search for a specific string in table object
llandale - Mon Mar 26 09:47:59 EDT 2012

A doors "table" has a single invisible "table" object and one or more subordinate invisible "row" objects. The "cell" objects which you can see are subordinate to the row objects.
These three perms tell you if an object is one of those 3 types.

  • bool table(Object)
  • bool row(Object)
  • bool cell(Object

These two perms get the corresponding "table" or "row", if any, for an object:

  • Object getTable(Object)
  • Object getRow(Object)


If you create a new module and insert a table and run the following code, you will see how it is structured:

 

string IsTrue(bool in_bool)
{  if (in_bool) //
   then return("true")
   else return("")
}
 
void   Info(Object obj)
{   print identifier(obj) "\t"IsTrue(table(obj)) "\t" IsTrue(row(obj)) "\t" IsTrue(cell(obj)) "\t"
    print (number(obj)) "\t\t[" obj."Object Text" "]\n"
}
 
Object oRow, oCell
print "ID\tTable\tRow\tCell\tPara\t\t[Text]\n"
for obj in entire (current Module) do
{  if (!table(obj))    continue
   Info(obj)
   for oRow in obj do
   {  Info(oRow)
      for oCell in oRow do
      {  Info(oCell)
      }
   }
}


So it seems to me you search Object Text for your string, and if you find it then oTable=getTable(obj) to see if its in a table, and if so do something like the above to print the entire table. Just make sure you print the table only once, even if it contains the string more than once. You could drop the oTable into a Skip list, ignoring it if it's already there.

 

 

Skip skpTablesDone = create()
for obj in mod do
{  if obj has my string
   {  oTable = getTable(obj)
      if (null oTable) then export obj
      elseif(put(skpTablesDone, oTable, oTable)) then export entire oTable
      else ignore obj // already exported this object's table
   }
}


-Louie

I've not yet had any reason to modify any attributes of table or row object, but I suppose there may be some obscure reason to do so.

 

Re: DXL script to search for a specific string in table object
GaneshPrasadE - Mon Mar 26 11:40:05 EDT 2012

llandale - Mon Mar 26 09:47:59 EDT 2012

A doors "table" has a single invisible "table" object and one or more subordinate invisible "row" objects. The "cell" objects which you can see are subordinate to the row objects.
These three perms tell you if an object is one of those 3 types.

  • bool table(Object)
  • bool row(Object)
  • bool cell(Object

These two perms get the corresponding "table" or "row", if any, for an object:

  • Object getTable(Object)
  • Object getRow(Object)


If you create a new module and insert a table and run the following code, you will see how it is structured:

 

string IsTrue(bool in_bool)
{  if (in_bool) //
   then return("true")
   else return("")
}
 
void   Info(Object obj)
{   print identifier(obj) "\t"IsTrue(table(obj)) "\t" IsTrue(row(obj)) "\t" IsTrue(cell(obj)) "\t"
    print (number(obj)) "\t\t[" obj."Object Text" "]\n"
}
 
Object oRow, oCell
print "ID\tTable\tRow\tCell\tPara\t\t[Text]\n"
for obj in entire (current Module) do
{  if (!table(obj))    continue
   Info(obj)
   for oRow in obj do
   {  Info(oRow)
      for oCell in oRow do
      {  Info(oCell)
      }
   }
}


So it seems to me you search Object Text for your string, and if you find it then oTable=getTable(obj) to see if its in a table, and if so do something like the above to print the entire table. Just make sure you print the table only once, even if it contains the string more than once. You could drop the oTable into a Skip list, ignoring it if it's already there.

 

 

Skip skpTablesDone = create()
for obj in mod do
{  if obj has my string
   {  oTable = getTable(obj)
      if (null oTable) then export obj
      elseif(put(skpTablesDone, oTable, oTable)) then export entire oTable
      else ignore obj // already exported this object's table
   }
}


-Louie

I've not yet had any reason to modify any attributes of table or row object, but I suppose there may be some obscure reason to do so.

 

Thank you llandale,
I'll work on your inputs.